/*
 * File Name:               UIEffectDown.cs
 * 
 * Description:             普通类
 * Author:                  lisiyu <576603306@qq.com>

 * Create Date:             2017/07/18
 */

using System;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;

public class UIEffectDown : MonoBehaviour, IPointerDownHandler
{
    public Animation animation;

    private void Start()
    {
        animation.gameObject.SetActive(true);
        animation.transform.localScale = Vector3.zero;
    }

    public void OnPointerDown(PointerEventData eventData)
    {
        animation.transform.localScale = Vector3.one;

        animation.Stop();
        animation.Play();
    }

    private void OnDisable()
    {
        animation.transform.localScale = Vector3.zero;
    }
}
